# coding=UTF-8

import datetime
from google.appengine.ext import db
from google.appengine.tools import bulkloader
import model.article
from google.appengine.api import users

class BlogLoader(bulkloader.Loader):
  def __init__(self):
    bulkloader.Loader.__init__(self, 'Article',
                               [('title', lambda title_s: unicode(str(title_s),'utf-8')),
                                ('date', lambda date_s:apply(datetime.datetime,map((lambda x:int(x)),date_s.split("-")))),
                                ('content',lambda content_s: unicode(str(content_s),'utf-8')),
                                ('tags', lambda tag_s:[unicode(tag_s,'utf-8')]),
                                ('author',users.User)
                               ])
loaders = [BlogLoader]
